﻿@page "/js"

@inject IJSRuntime JS

<button @onclick="Prompt">点我一下</button>
@name
@*
    window.alert("")
    
    let msg = window.prompt("xxxx");
*@

@code{
    string name;
    async Task Prompt()
    {

        //name = await JS.InvokeAsync<string>("prompt", "输入名字");

        //import * from '...'

        var module= await JS.InvokeAsync<IJSObjectReference>("import", "./_content/BlazorLearn.Shared/app.js");

        await module.InvokeVoidAsync("invokeRun", DotNetObjectReference.Create(this));
    }

    [JSInvokable]
    public void Run()
    {
        Console.WriteLine("Run is invoked");
    }
}